home *** CD-ROM | disk | FTP | other *** search
-
- regc(0, "COMBINED_XFORM")
- regc(4, "MODEL_XFORM")
-
- regc(12, "FOG_PARAMS")
-
- regc(14, "CAMERA_POS_MS")
-
- vshader("
-
- #define point v0
- #define normal v1
- #define tangent v2
- #define tcoord v3
-
- #define fogp c12
- #define lpos c13
- #define cpos c14
-
- #include <fog.inc>
-
- vs_1_1
-
- dcl_position point
- dcl_normal normal
- dcl_tangent tangent
- dcl_texcoord tcoord
-
- ; output position
- m4x4 oPos, point, c0
-
- ; output texcoords
- mov oT0, tcoord // color
-
- ; calc tangent space basis, binormal = cross( normal, tangent )
- mov r2, tangent
- mul r3, r2.zxyw, normal.yzxw;
- mad r3, r2.yzxw, normal.zxyw, -r3
-
- ; output tangent -> world-space xform
- dp3 oT2.x, tangent, c4
- dp3 oT3.x, tangent, c5
- dp3 oT4.x, tangent, c6
-
- dp3 oT2.y, r3, c4
- dp3 oT3.y, r3, c5
- dp3 oT4.y, r3, c6
-
- dp3 oT2.z, normal, c4
- dp3 oT3.z, normal, c5
- dp3 oT4.z, normal, c6
-
- ; E in tangent space
- add r0, cpos, -point
- dp3 oT1.x, tangent, r0
- dp3 oT1.y, r3, r0
- dp3 oT1.z, normal, r0
-
- ; calc fog
- dp4 r0.x, point, c2
- FOG(r0.x, fogp, r10)
- ")
-
-